library(ggplot2)

dfMnCo<-read.csv("1L2_Mn_Co_titration.csv")

#create line plot
ggplot(dfMnCo, aes(x=Concentration, y=Mean_RelativeActivity, color = Sample, group = Sample)) +
  geom_line(size=0.6, show.legend = F)+
  geom_point(aes(shape=Sample, color=Sample), size=3, show.legend = T)+
  scale_color_manual(values= c("deeppink", "darkblue"),labels=c(expression(paste("Co"^"2+")), expression(paste("Mn"^"2+"))))+
  scale_shape_manual(values=c(19, 21), labels=c(expression(paste("Co"^"2+")), expression(paste("Mn"^"2+"))))+
  geom_errorbar(data = dfMnCo, aes(ymin=Mean_RelativeActivity-StDev, ymax=Mean_RelativeActivity+StDev), width=0.2) +
  theme_minimal() +
  labs(
    title = "Divalent cations titration",
    x = "[Divalent cations] (mM)",
    y = "Relative DNase activity (%)"
  )+
  theme(axis.text.x = element_text(size = 16), axis.text.y = element_text(size = 16), 
        axis.title.y = element_text(size=20), axis.title.x = element_text(size=20), 
        title = element_text(size = 16), 
        legend.title = element_blank(), legend.text = element_text(size=16), 
        legend.position = c(0.7, 0.58), legend.key.height = unit(0.9, "cm"), 
        plot.margin = margin(0.5, 0.5, 0.5, 0.5, "cm"))

ggsave("MnCo_titration.pdf", width = 17, height = 15, units = "cm")